Optimal. Leaf size=154 \[ -\frac {4 \sqrt [4]{-1} a^2 (A-i B) \text {ArcTan}\left ((-1)^{3/4} \sqrt {\tan (c+d x)}\right )}{d}-\frac {2 a^2 (9 i A+7 B)}{35 d \tan ^{\frac {5}{2}}(c+d x)}+\frac {4 a^2 (A-i B)}{3 d \tan ^{\frac {3}{2}}(c+d x)}+\frac {4 a^2 (i A+B)}{d \sqrt {\tan (c+d x)}}-\frac {2 A \left (a^2+i a^2 \tan (c+d x)\right )}{7 d \tan ^{\frac {7}{2}}(c+d x)} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.21, antiderivative size = 154, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 5, integrand size = 36, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.139, Rules used = {3674, 3672,
3610, 3614, 211} \begin {gather*} -\frac {4 \sqrt [4]{-1} a^2 (A-i B) \text {ArcTan}\left ((-1)^{3/4} \sqrt {\tan (c+d x)}\right )}{d}+\frac {4 a^2 (A-i B)}{3 d \tan ^{\frac {3}{2}}(c+d x)}-\frac {2 a^2 (7 B+9 i A)}{35 d \tan ^{\frac {5}{2}}(c+d x)}+\frac {4 a^2 (B+i A)}{d \sqrt {\tan (c+d x)}}-\frac {2 A \left (a^2+i a^2 \tan (c+d x)\right )}{7 d \tan ^{\frac {7}{2}}(c+d x)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 211
Rule 3610
Rule 3614
Rule 3672
Rule 3674
Rubi steps
\begin {align*} \int \frac {(a+i a \tan (c+d x))^2 (A+B \tan (c+d x))}{\tan ^{\frac {9}{2}}(c+d x)} \, dx &=-\frac {2 A \left (a^2+i a^2 \tan (c+d x)\right )}{7 d \tan ^{\frac {7}{2}}(c+d x)}+\frac {2}{7} \int \frac {(a+i a \tan (c+d x)) \left (\frac {1}{2} a (9 i A+7 B)-\frac {1}{2} a (5 A-7 i B) \tan (c+d x)\right )}{\tan ^{\frac {7}{2}}(c+d x)} \, dx\\ &=-\frac {2 a^2 (9 i A+7 B)}{35 d \tan ^{\frac {5}{2}}(c+d x)}-\frac {2 A \left (a^2+i a^2 \tan (c+d x)\right )}{7 d \tan ^{\frac {7}{2}}(c+d x)}+\frac {2}{7} \int \frac {-7 a^2 (A-i B)-7 a^2 (i A+B) \tan (c+d x)}{\tan ^{\frac {5}{2}}(c+d x)} \, dx\\ &=-\frac {2 a^2 (9 i A+7 B)}{35 d \tan ^{\frac {5}{2}}(c+d x)}+\frac {4 a^2 (A-i B)}{3 d \tan ^{\frac {3}{2}}(c+d x)}-\frac {2 A \left (a^2+i a^2 \tan (c+d x)\right )}{7 d \tan ^{\frac {7}{2}}(c+d x)}+\frac {2}{7} \int \frac {-7 a^2 (i A+B)+7 a^2 (A-i B) \tan (c+d x)}{\tan ^{\frac {3}{2}}(c+d x)} \, dx\\ &=-\frac {2 a^2 (9 i A+7 B)}{35 d \tan ^{\frac {5}{2}}(c+d x)}+\frac {4 a^2 (A-i B)}{3 d \tan ^{\frac {3}{2}}(c+d x)}+\frac {4 a^2 (i A+B)}{d \sqrt {\tan (c+d x)}}-\frac {2 A \left (a^2+i a^2 \tan (c+d x)\right )}{7 d \tan ^{\frac {7}{2}}(c+d x)}+\frac {2}{7} \int \frac {7 a^2 (A-i B)+7 a^2 (i A+B) \tan (c+d x)}{\sqrt {\tan (c+d x)}} \, dx\\ &=-\frac {2 a^2 (9 i A+7 B)}{35 d \tan ^{\frac {5}{2}}(c+d x)}+\frac {4 a^2 (A-i B)}{3 d \tan ^{\frac {3}{2}}(c+d x)}+\frac {4 a^2 (i A+B)}{d \sqrt {\tan (c+d x)}}-\frac {2 A \left (a^2+i a^2 \tan (c+d x)\right )}{7 d \tan ^{\frac {7}{2}}(c+d x)}+\frac {\left (28 a^4 (A-i B)^2\right ) \text {Subst}\left (\int \frac {1}{7 a^2 (A-i B)-7 a^2 (i A+B) x^2} \, dx,x,\sqrt {\tan (c+d x)}\right )}{d}\\ &=-\frac {4 \sqrt [4]{-1} a^2 (A-i B) \tan ^{-1}\left ((-1)^{3/4} \sqrt {\tan (c+d x)}\right )}{d}-\frac {2 a^2 (9 i A+7 B)}{35 d \tan ^{\frac {5}{2}}(c+d x)}+\frac {4 a^2 (A-i B)}{3 d \tan ^{\frac {3}{2}}(c+d x)}+\frac {4 a^2 (i A+B)}{d \sqrt {\tan (c+d x)}}-\frac {2 A \left (a^2+i a^2 \tan (c+d x)\right )}{7 d \tan ^{\frac {7}{2}}(c+d x)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 5.48, size = 296, normalized size = 1.92 \begin {gather*} \frac {\cos ^3(c+d x) \left (\frac {4 (A-i B) e^{-2 i c} \sqrt {-\frac {i \left (-1+e^{2 i (c+d x)}\right )}{1+e^{2 i (c+d x)}}} \tanh ^{-1}\left (\sqrt {\frac {-1+e^{2 i (c+d x)}}{1+e^{2 i (c+d x)}}}\right )}{\sqrt {\frac {-1+e^{2 i (c+d x)}}{1+e^{2 i (c+d x)}}}}-\frac {\csc ^3(c+d x) (\cos (2 c)-i \sin (2 c)) ((-25 A+70 i B) \cos (c+d x)+(85 A-70 i B) \cos (3 (c+d x))+42 (-8 i A-9 B+(12 i A+11 B) \cos (2 (c+d x))) \sin (c+d x))}{210 \sqrt {\tan (c+d x)}}\right ) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x))}{d (\cos (d x)+i \sin (d x))^2 (A \cos (c+d x)+B \sin (c+d x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.04, size = 258, normalized size = 1.68
method | result | size |
derivativedivides | \(\frac {a^{2} \left (-\frac {2 A}{7 \tan \left (d x +c \right )^{\frac {7}{2}}}-\frac {2 \left (2 i B -2 A \right )}{3 \tan \left (d x +c \right )^{\frac {3}{2}}}-\frac {2 \left (-2 i A -2 B \right )}{\sqrt {\tan \left (d x +c \right )}}-\frac {2 \left (2 i A +B \right )}{5 \tan \left (d x +c \right )^{\frac {5}{2}}}+\frac {\left (-2 i B +2 A \right ) \sqrt {2}\, \left (\ln \left (\frac {1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )+\tan \left (d x +c \right )}{1-\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )+\tan \left (d x +c \right )}\right )+2 \arctan \left (1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )\right )+2 \arctan \left (-1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )\right )\right )}{4}+\frac {\left (2 i A +2 B \right ) \sqrt {2}\, \left (\ln \left (\frac {1-\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )+\tan \left (d x +c \right )}{1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )+\tan \left (d x +c \right )}\right )+2 \arctan \left (1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )\right )+2 \arctan \left (-1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )\right )\right )}{4}\right )}{d}\) | \(258\) |
default | \(\frac {a^{2} \left (-\frac {2 A}{7 \tan \left (d x +c \right )^{\frac {7}{2}}}-\frac {2 \left (2 i B -2 A \right )}{3 \tan \left (d x +c \right )^{\frac {3}{2}}}-\frac {2 \left (-2 i A -2 B \right )}{\sqrt {\tan \left (d x +c \right )}}-\frac {2 \left (2 i A +B \right )}{5 \tan \left (d x +c \right )^{\frac {5}{2}}}+\frac {\left (-2 i B +2 A \right ) \sqrt {2}\, \left (\ln \left (\frac {1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )+\tan \left (d x +c \right )}{1-\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )+\tan \left (d x +c \right )}\right )+2 \arctan \left (1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )\right )+2 \arctan \left (-1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )\right )\right )}{4}+\frac {\left (2 i A +2 B \right ) \sqrt {2}\, \left (\ln \left (\frac {1-\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )+\tan \left (d x +c \right )}{1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )+\tan \left (d x +c \right )}\right )+2 \arctan \left (1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )\right )+2 \arctan \left (-1+\sqrt {2}\, \left (\sqrt {\tan }\left (d x +c \right )\right )\right )\right )}{4}\right )}{d}\) | \(258\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.50, size = 213, normalized size = 1.38 \begin {gather*} -\frac {105 \, {\left (2 \, \sqrt {2} {\left (-\left (i + 1\right ) \, A + \left (i - 1\right ) \, B\right )} \arctan \left (\frac {1}{2} \, \sqrt {2} {\left (\sqrt {2} + 2 \, \sqrt {\tan \left (d x + c\right )}\right )}\right ) + 2 \, \sqrt {2} {\left (-\left (i + 1\right ) \, A + \left (i - 1\right ) \, B\right )} \arctan \left (-\frac {1}{2} \, \sqrt {2} {\left (\sqrt {2} - 2 \, \sqrt {\tan \left (d x + c\right )}\right )}\right ) + \sqrt {2} {\left (\left (i - 1\right ) \, A + \left (i + 1\right ) \, B\right )} \log \left (\sqrt {2} \sqrt {\tan \left (d x + c\right )} + \tan \left (d x + c\right ) + 1\right ) - \sqrt {2} {\left (\left (i - 1\right ) \, A + \left (i + 1\right ) \, B\right )} \log \left (-\sqrt {2} \sqrt {\tan \left (d x + c\right )} + \tan \left (d x + c\right ) + 1\right )\right )} a^{2} - \frac {4 \, {\left (210 \, {\left (i \, A + B\right )} a^{2} \tan \left (d x + c\right )^{3} + 70 \, {\left (A - i \, B\right )} a^{2} \tan \left (d x + c\right )^{2} + 21 \, {\left (-2 i \, A - B\right )} a^{2} \tan \left (d x + c\right ) - 15 \, A a^{2}\right )}}{\tan \left (d x + c\right )^{\frac {7}{2}}}}{210 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 561 vs. \(2 (124) = 248\).
time = 2.57, size = 561, normalized size = 3.64 \begin {gather*} \frac {105 \, \sqrt {-\frac {{\left (i \, A^{2} + 2 \, A B - i \, B^{2}\right )} a^{4}}{d^{2}}} {\left (d e^{\left (8 i \, d x + 8 i \, c\right )} - 4 \, d e^{\left (6 i \, d x + 6 i \, c\right )} + 6 \, d e^{\left (4 i \, d x + 4 i \, c\right )} - 4 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )} \log \left (-\frac {2 \, {\left ({\left (A - i \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + \sqrt {-\frac {{\left (i \, A^{2} + 2 \, A B - i \, B^{2}\right )} a^{4}}{d^{2}}} {\left (i \, d e^{\left (2 i \, d x + 2 i \, c\right )} + i \, d\right )} \sqrt {\frac {-i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}}\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{{\left (-i \, A - B\right )} a^{2}}\right ) - 105 \, \sqrt {-\frac {{\left (i \, A^{2} + 2 \, A B - i \, B^{2}\right )} a^{4}}{d^{2}}} {\left (d e^{\left (8 i \, d x + 8 i \, c\right )} - 4 \, d e^{\left (6 i \, d x + 6 i \, c\right )} + 6 \, d e^{\left (4 i \, d x + 4 i \, c\right )} - 4 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )} \log \left (-\frac {2 \, {\left ({\left (A - i \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + \sqrt {-\frac {{\left (i \, A^{2} + 2 \, A B - i \, B^{2}\right )} a^{4}}{d^{2}}} {\left (-i \, d e^{\left (2 i \, d x + 2 i \, c\right )} - i \, d\right )} \sqrt {\frac {-i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}}\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{{\left (-i \, A - B\right )} a^{2}}\right ) - 2 \, {\left ({\left (337 \, A - 301 i \, B\right )} a^{2} e^{\left (8 i \, d x + 8 i \, c\right )} - 6 \, {\left (46 \, A - 63 i \, B\right )} a^{2} e^{\left (6 i \, d x + 6 i \, c\right )} - 10 \, {\left (5 \, A - 14 i \, B\right )} a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} + 18 \, {\left (22 \, A - 21 i \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} - {\left (167 \, A - 161 i \, B\right )} a^{2}\right )} \sqrt {\frac {-i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}}}{105 \, {\left (d e^{\left (8 i \, d x + 8 i \, c\right )} - 4 \, d e^{\left (6 i \, d x + 6 i \, c\right )} + 6 \, d e^{\left (4 i \, d x + 4 i \, c\right )} - 4 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} - a^{2} \left (\int \left (- \frac {A}{\tan ^{\frac {9}{2}}{\left (c + d x \right )}}\right )\, dx + \int \frac {A}{\tan ^{\frac {5}{2}}{\left (c + d x \right )}}\, dx + \int \left (- \frac {B}{\tan ^{\frac {7}{2}}{\left (c + d x \right )}}\right )\, dx + \int \frac {B}{\tan ^{\frac {3}{2}}{\left (c + d x \right )}}\, dx + \int \left (- \frac {2 i A}{\tan ^{\frac {7}{2}}{\left (c + d x \right )}}\right )\, dx + \int \left (- \frac {2 i B}{\tan ^{\frac {5}{2}}{\left (c + d x \right )}}\right )\, dx\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 1.19, size = 136, normalized size = 0.88 \begin {gather*} \frac {\left (2 i - 2\right ) \, \sqrt {2} {\left (-i \, A a^{2} - B a^{2}\right )} \arctan \left (-\left (\frac {1}{2} i - \frac {1}{2}\right ) \, \sqrt {2} \sqrt {\tan \left (d x + c\right )}\right )}{d} - \frac {2 \, {\left (-210 i \, A a^{2} \tan \left (d x + c\right )^{3} - 210 \, B a^{2} \tan \left (d x + c\right )^{3} - 70 \, A a^{2} \tan \left (d x + c\right )^{2} + 70 i \, B a^{2} \tan \left (d x + c\right )^{2} + 42 i \, A a^{2} \tan \left (d x + c\right ) + 21 \, B a^{2} \tan \left (d x + c\right ) + 15 \, A a^{2}\right )}}{105 \, d \tan \left (d x + c\right )^{\frac {7}{2}}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 9.52, size = 293, normalized size = 1.90 \begin {gather*} -\frac {\frac {2\,A\,a^2}{7\,d}+\frac {A\,a^2\,\mathrm {tan}\left (c+d\,x\right )\,4{}\mathrm {i}}{5\,d}-\frac {4\,A\,a^2\,{\mathrm {tan}\left (c+d\,x\right )}^2}{3\,d}-\frac {A\,a^2\,{\mathrm {tan}\left (c+d\,x\right )}^3\,4{}\mathrm {i}}{d}}{{\mathrm {tan}\left (c+d\,x\right )}^{7/2}}-\frac {\frac {2\,B\,a^2}{5\,d}-\frac {4\,B\,a^2\,{\mathrm {tan}\left (c+d\,x\right )}^2}{d}+\frac {B\,a^2\,\mathrm {tan}\left (c+d\,x\right )\,4{}\mathrm {i}}{3\,d}}{{\mathrm {tan}\left (c+d\,x\right )}^{5/2}}+\frac {\sqrt {2}\,A\,a^2\,\ln \left (A\,a^2\,d\,4{}\mathrm {i}+\sqrt {2}\,A\,a^2\,d\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}\,\left (-2+2{}\mathrm {i}\right )\right )\,\left (1-\mathrm {i}\right )}{d}-\frac {\sqrt {-4{}\mathrm {i}}\,A\,a^2\,\ln \left (A\,a^2\,d\,4{}\mathrm {i}+2\,\sqrt {-4{}\mathrm {i}}\,A\,a^2\,d\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}\right )}{d}+\frac {\sqrt {2}\,B\,a^2\,\ln \left (4\,B\,a^2\,d+\sqrt {2}\,B\,a^2\,d\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}\,\left (-2-2{}\mathrm {i}\right )\right )\,\left (1+1{}\mathrm {i}\right )}{d}-\frac {\sqrt {4{}\mathrm {i}}\,B\,a^2\,\ln \left (4\,B\,a^2\,d+2\,\sqrt {4{}\mathrm {i}}\,B\,a^2\,d\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________